<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>安装质量报告</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="../../../../css/mui.min.css">
    <link rel="stylesheet" href="../../../../css/global.css">
    <link rel="stylesheet" href="../../../../css/style.css">
    <link rel="stylesheet" href="../../../../css/mui.picker.css">
    <link rel="stylesheet" href="../../../../css/mui.poppicker.css">
    <style>
        button:disabled {
            opacity: 1;
        }
    </style>
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 id="title" class="mui-title">安装质量报告</h1>
</header>
<div class="mui-content">
    <div class="details_con">
        <div hidden>
            <input type="hidden" id="id"/>
            <input type="hidden" id="planId"/>
            <input type="hidden" id="ServiceNoticeId"/>
            <input type="hidden" id="helpId"/>
            <input type="hidden" id="serviceNoV"/>
            <input type="hidden" id="instrumentNo"/>
        </div>
        <div class="clum">
            <span class="name">服务编号</span>
            <span id="serviceNo" class="txt"></span>
        </div>
        <div class="clum">
            <span class="name">工程师姓名</span>
            <span id="fseName" class="txt"></span>
        </div>
        <div class="clum">
            <span class="name">安装起始日期<em class="t_red">*</em></span>
            <button id='installStartTime' type="button" class="selectDate">请选择安装起始日期</button>
        </div>
        <div class="clum">
            <span class="name">安装截止日期<em class="t_red">*</em></span>
            <button id='installEndTime' type="button" class="selectDate">请选择安装截止日期</button>
        </div>
        <div class="clum">
            <span class="name">保修起始日期<em class="t_red">*</em></span>
            <!-- <input type="text" id="warrantyStartTime" class="d_ipt" disabled="disabled"/> -->
            <button id='warrantyStartTime' type="button" class="selectDate">请选择保修起始日期</button>
        </div>
        <div class="clum">
            <span class="name">保修截止日期<em class="t_red">*</em></span>
            <!-- <input type="text" id="warrantyEndTime" class="d_ipt" disabled="disabled"/> -->
            <button id='warrantyEndTime' type="button" class="selectDate">请选择保修截止日期</button>
        </div>
        <!-- <div class="clum">
            <span class="name">到货完整</span>
            <input type="text" id="modelNumber" class="d_ipt" value="是" />
        </div>
        <div class="clum">
            <span class="name">系统质量如何</span>
            <input type="text" id="modelNumber" class="d_ipt" value="优秀" />
        </div> -->
        <div class="clum">
            <span class="name">工作小时数<em class="t_red">*</em></span>
            <input type="number" id="workTime" class="d_ipt" value="" placeholder="请输入"/>
        </div>
        <div class="clum">
            <span class="name">旅途小时数<em class="t_red">*</em></span>
            <input type="number" id="tripTime" class="d_ipt" value="" placeholder="请输入"/>
        </div>
        <div class="clum">
            <span class="name">浪费时间</span>
            <input type="number" id="wasteTime" class="d_ipt" value="" placeholder="请输入"/>
        </div>
        <div class="clum">
            <span class="name">加班时间</span>
            <input type="number" id="workOvertime" class="d_ipt" value="" placeholder="请输入"/>
        </div>
        <div class="my-content-cell">
            <div class="inline-block" id="rjjsbxx">
                <em>软件及设备信息</em>
                <span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
            </div>
        </div>
        <div class="my-content-cell">
            <div class="inline-block" id="bjlb">
                <em>备件列表</em>
                <span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
            </div>
        </div>
        <div class="my-content-cell">
            <div class="inline-block" id="zybjlb">
                <em>主要备件列表</em>
                <span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
            </div>
        </div>
        <!--<div class="my-content-cell">
            <div class="inline-block" id="tjfssb">
                <em>添加附属设备</em>
                <span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
            </div>
        </div>-->
        <div class="my-content-cell">
            <div class="inline-block" id="fssblb">
                <em>附属设备列表</em>
                <span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
            </div>
        </div>
        <div class="btn_box">
            <button id="saveBtn" class="fl">保存草稿</button>
            <button id="submitBtn" class="fr red">正式提交</button>
        </div>
        <div style="height: 50px;"></div>
    </div>
</div>

<!-- js代码 start -->

<!-- 基础js start -->
<script src="../../../../js/mui.min.js"></script>
<script src="../../../../js/utils/h.js"></script>
<script src="../../../../js/constant.js"></script>
<script src="../../../../js/common.js"></script>
<script src="../../../../js/utils/base64.js"></script>
<script src="../../../../js/utils/md5.js"></script>
<script src="../../../../js/utils/sortMap.js"></script>
<script src="../../../../js/utils/http.js"></script>
<script src="../../../../js/app.js"></script>
<!-- 基础js end -->
<script src="../../../../js/utils/rolldate.min.js"></script>
<script src="../../../../js/mui.picker.js"></script>
<script src="../../../../js/mui.poppicker.js"></script>
<script type="text/javascript" charset="utf-8">
    // 子页面数据
    var equipmentType1 = "";
    var serialNumber1 = "";
    var equipmentType2 = "";
    var serialNumber2 = "";
    var equipmentType3 = "";
    var serialNumber3 = "";
    var computerMfr = "";
    var modelNumber = "";
    var serviceNumber = "";
    var software = "";
    var optionSoftware = "";
    var systemSoftware = "";
	var reportId;
    var id = "";
    var InstrumentCode = "";
    var instrumentNo;
	var saveDelPartIds = "";

    function saveData(tips, callBack) {
        var newDate = new Date().getTime(); // 当前时间
        var installStartTime = h("#installStartTime").html()
        if (!installStartTime || installStartTime == '请选择安装起始日期') {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('请选择安装起始日期');
            return;
        }

        var installEndTime = h("#installEndTime").html()
        if (!installEndTime || installEndTime == '请选择安装截止日期') {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('请选择安装截止日期');
            return;
        }
        if (stringYYYYMMDDHHMMToDate(installEndTime).getTime() > newDate) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('安装截止日期不能大于当前时间')
            return false
        }
        if (installStartTime > installEndTime) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('安装起始日期不能大于安装截止日期');
            return;
        }

        var warrantyStartTime = h("#warrantyStartTime").html()
        if (!warrantyStartTime || warrantyStartTime == '请选择保修起始日期') {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('请选择保修起始日期');
            return;
        }

        var warrantyEndTime = h("#warrantyEndTime").html()
        if (!warrantyEndTime || warrantyEndTime == '请选择保修截止日期') {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('请选择保修截止日期');
            return;
        }
        if (warrantyStartTime > warrantyEndTime) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('保修起始日期不能大于保修截止日期');
            return;
        }
		// 二位小数正则校验
		var re = /^\d*\.{0,1}\d{0,1}\d$/;
        var workTime = h("#workTime").val()
        if (!workTime) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('请输入工作小时数');
            return;
        } else if (!re.exec(workTime)) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
			app.toast('工作小时数只能保留2位小数');
			return;
		}
		var tripTime = h("#tripTime").val()	
        if (!tripTime) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.toast('请输入旅途小时数');
            return;
        } else if (!re.exec(tripTime)) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
			app.toast('旅途小时数只能保留2位小数');
			return;
        }
		var wasteTime = h("#wasteTime").val()
		if (wasteTime && !re.exec(wasteTime)) {
		    app.toast('浪费时间数只能保留2位小数');
		    return;
		}
		var workOvertime = h("#workOvertime").val()
		if (workOvertime && !re.exec(workOvertime)) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
		    app.toast('加班时间数只能保留2位小数');
		    return;
		}
        var url = "";
        if (id != undefined && id != "") {// 修改
            url = "cc/installation/quality/report/updateInstallationQualityReport"
        } else {// 新增
            url = "cc/installation/quality/report/addInstallationQualityReport"
        }
        var data = {};
        var fseName = app.getUser().name
        if (!id) {
            data = {
                "noticeId": h("#ServiceNoticeId").val(),
                "serviceNo": h("#serviceNoV").val(),
                "enginnerId": app.getUser().enginnerId,
                "planId": h("#planId").val(),
                "installStartTime": h("#installStartTime").html(),
                "installEndTime": h("#installEndTime").html(),
                "warrantyStartTime": warrantyStartTime,
                "warrantyEndTime": warrantyEndTime,
                "workTime": h("#workTime").val(),
                "tripTime": h("#tripTime").val(),
                "wasteTime": wasteTime,
                "workOvertime": workOvertime,
                "fseName": fseName,
                "equipmentType1": equipmentType1 ? equipmentType1 : "",
                "serialNumber1": serialNumber1 ? serialNumber1 : "",
                "equipmentType2": equipmentType2 ? equipmentType2 : "",
                "serialNumber2": serialNumber2 ? serialNumber2 : "",
                "equipmentType3": equipmentType3 ? equipmentType3 : "",
                "serialNumber3": serialNumber3 ? serialNumber3 : "",
                "computerMfr": computerMfr ? computerMfr : "",
                "modelNumber": modelNumber ? modelNumber : "",
                "serviceNumber": serviceNumber ? serviceNumber : "",
                "software": software ? software : "",
                "optionSoftware": optionSoftware ? optionSoftware : "",
                "systemSoftware": systemSoftware ? systemSoftware : "",
				"saveDelPartIds": saveDelPartIds
            }
        } else {
            data = {
                "noticeId": h("#ServiceNoticeId").val(),
                "serviceNo": h("#serviceNoV").val(),
                "enginnerId": app.getUser().enginnerId,
                "planId": h("#planId").val(),
                "installStartTime": h("#installStartTime").html(),
                "installEndTime": h("#installEndTime").html(),
                "warrantyStartTime": warrantyStartTime,
                "warrantyEndTime": warrantyEndTime,
                "workTime": h("#workTime").val(),
                "tripTime": h("#tripTime").val(),
                "wasteTime": h("#wasteTime").val(),
                "workOvertime": h("#workOvertime").val(),
                "equipmentType1": equipmentType1 ? equipmentType1 : "",
                "serialNumber1": serialNumber1 ? serialNumber1 : "",
                "equipmentType2": equipmentType2 ? equipmentType2 : "",
                "serialNumber2": serialNumber2 ? serialNumber2 : "",
                "equipmentType3": equipmentType3 ? equipmentType3 : "",
                "serialNumber3": serialNumber3 ? serialNumber3 : "",
                "computerMfr": computerMfr ? computerMfr : "",
                "modelNumber": modelNumber ? modelNumber : "",
                "serviceNumber": serviceNumber ? serviceNumber : "",
                "software": software ? software : "",
                "optionSoftware": optionSoftware ? optionSoftware : "",
                "systemSoftware": systemSoftware ? systemSoftware : "",
                "fseName": fseName,
				"saveDelPartIds": saveDelPartIds,
                "id": id
            }
        }
        app.showWaiting(tips)
        ajaxPost(BASE_URL + url, data, function (data) {
            console.log(JSON.stringify(data))
            callBack(data)
        }, function (errorMsg) {
			h('#saveBtn').removeAttr('disabled');
			h('#submitBtn').removeAttr('disabled');
            app.closeWaiting()
            console.log(JSON.stringify(errorMsg))
        });
    }

    // 提交状态 0未提交 1已提交
    var submitStatus = 0;

    /*
    * 禁止交互事件
    */
    function noInteraction() {

        if (submitStatus && submitStatus == '1') {
            h('#installStartTime').attr('disabled', 'disabled')
            h('#installEndTime').attr('disabled', 'disabled')
            h('#warrantyStartTime').attr('disabled', 'disabled')
            h('#warrantyEndTime').attr('disabled', 'disabled')

            h('#workTime').attr('readonly', 'readonly')
            h('#tripTime').attr('readonly', 'readonly')
            h('#wasteTime').attr('readonly', 'readonly')
            h('#workOvertime').attr('readonly', 'readonly')

            // h('#tjzybj').parent().hide()
            // h('#tjfssb').parent().hide()
            h('#saveBtn').hide()
            h('#submitBtn').hide()
        }


    }

    (function ($, doc) {

        $.init();
        $.plusReady(function () {
            var self = plus.webview.currentWebview();
            submitStatus = self.submitStatus;
            instrumentNo = self.instrumentNo;
			reportId = self.reportId;
            h("#instrumentNo").val(instrumentNo);
            // 获取上一个页面传过来的参数并显示到页面
            h('#serviceNo').html(self.serviceNo);
            h('#serviceNoV').val(self.serviceNo);
            h('#planId').val(self.planId);
            h('#ServiceNoticeId').val(self.ServiceNoticeId);
            var helpId = new Date().UUID(self.serviceNo)
            h('#helpId').val(helpId)
            h('#fseName').html(app.getUser().name);
            if (!JS.IsNullOrEmpty(self.iqrId)) {
                id = self.iqrId;
                h("#id").val(id);
            }

            // 初始化时间控件 安装起始日期
            new Rolldate({
                el: '#installStartTime',
                format: 'YYYY-MM-DD hh:mm',
                beginYear: 2015,
                endYear: 2050,
                trigger: 'click',
                lang: {
                    title: '请选择安装起始日期',
                },
                confirm: function (date) {

                }
            })
            // 初始化时间控件 安装截止日期
            new Rolldate({
                el: '#installEndTime',
                format: 'YYYY-MM-DD hh:mm',
                beginYear: 2015,
                endYear: 2050,
                trigger: 'click',
                lang: {
                    title: '请选择安装截止日期',
                },
                confirm: function (date) {

                }
            })
            // 初始化时间控件 保修起始日期
            new Rolldate({
                el: '#warrantyStartTime',
                format: 'YYYY-MM-DD hh:mm',
                beginYear: 2015,
                endYear: 2050,
                trigger: 'click',
                lang: {
                    title: '请选择保修起始日期',
                },
                confirm: function (date) {

                }
            })
            // 初始化时间控件 保修截止日期
            new Rolldate({
                el: '#warrantyEndTime',
                format: 'YYYY-MM-DD hh:mm',
                beginYear: 2015,
                endYear: 2050,
                trigger: 'click',
                lang: {
                    title: '请选择保修截止日期',
                },
                confirm: function (date) {

                }
            })

            noInteraction()
            // 数据初始化带入默认数据
            initData();

            // 备件列表查询方法
            h("#bjlb").tap(function () {
                app.jumpTo("/view/service/report/installationquality/partlist.html", "view/service/report/installationquality/partlist.html",
                    {
                        reportId: reportId,
						ServiceNoticeId: h("#ServiceNoticeId").val(),
                        serviceNo: h("#serviceNoV").val(),
                        helpId: h("#helpId").val(),
                        submitStatus: submitStatus
                    })
            });

            // 添加主要备件
            h("#tjzybj").tap(function () {
                app.jumpTo("/view/service/report/installationquality/mainSpareParts/add.html", "view/service/report/installationquality/mainSpareParts/add.html",
                    {
                        ServiceNoticeId: h("#ServiceNoticeId").val(),
                        serviceNo: h("#serviceNoV").val(),
                        instrumentNo: h("#instrumentNo").val()
                    })
            })

            // 主要备件列表
            h("#zybjlb").tap(function () {
                app.jumpTo("/view/service/report/installationquality/mainSpareParts/list.html", "view/service/report/installationquality/mainSpareParts/list.html",
                    {
                        ServiceNoticeId: h("#ServiceNoticeId").val(),
                        serviceNo: h("#serviceNoV").val(),
                        instrumentNo: h("#instrumentNo").val(),
                        submitStatus: submitStatus
                    })
            })


            // 添加附属设备
            h("#tjfssb").tap(function () {
                app.jumpTo("/view/service/report/installationquality/accessoryEquipment/add.html", "view/service/report/installationquality/accessoryEquipment/add.html",
                    {
                        ServiceNoticeId: h("#ServiceNoticeId").val(),
                        serviceNo: h("#serviceNoV").val(),
                        instrumentNo: h("#instrumentNo").val(),
                        submitStatus: submitStatus
                    })
            })

            // 附属设备类别查询
            h("#fssblb").tap(function () {
                app.jumpTo("/view/service/report/installationquality/accessoryEquipment/list.html", "view/service/report/installationquality/accessoryEquipment/list.html",
                    {
                        ServiceNoticeId: h("#ServiceNoticeId").val(),
                        serviceNo: h("#serviceNoV").val(),
                        instrumentNo: h("#instrumentNo").val(),
                        submitStatus: submitStatus
                    })
            })

            // 软件及设备信息
            h("#rjjsbxx").tap(function () {
                app.jumpTo("/view/service/report/installationquality/softwareAndParts.html", "view/service/report/installationquality/softwareAndParts.html",
                    {
                        ServiceNoticeId: h("#ServiceNoticeId").val(),
                        serviceNo: h("#serviceNoV").val(),
                        iqrId: id,
                        submitStatus: submitStatus,
                        equipmentType1: equipmentType1,
                        serialNumber1: serialNumber1,
                        equipmentType2: equipmentType2,
                        serialNumber2: serialNumber2,
                        equipmentType3: equipmentType3,
                        serialNumber3: serialNumber3,
                        computerMfr: computerMfr,
                        modelNumber: modelNumber,
                        serviceNumber: serviceNumber,
                        software: software,
						
                        optionSoftware: optionSoftware,
                        systemSoftware: systemSoftware,
                        InstrumentCode: InstrumentCode
                    })
            })

            // 保存草稿按钮触发事件
            h('#saveBtn').tap(function () {
				h(this).attr('disabled','disabled');
                saveData('正在保存...', function (data) {
                    app.closeWaiting()
                    if (data.code == 200) {
                        id = data.data.id;
                        app.toast("保存成功");
                        var webviews = plus.webview.all();
                        for (var i = 0; i < webviews.length; i++) {
                            console.log(webviews[i].id);
                        }
                        var workReportList = plus.webview.getWebviewById('view/service/report/work/workReportList.html')
                        if (workReportList) {
                            workReportList.evalJS("initData()")
                        }
						saveDelPartIds = "";
                        mui.back()
                    } else {
						h('#saveBtn').removeAttr('disabled');
                        app.toast(data.msg)
                    }
                })
            })

            // 正式提交按钮触发事件
            h('#submitBtn').tap(function () {
				h(this).attr('disabled','disabled');
                saveData('正在提交...', function (data) {
                    if (data.code == 200) {
                        id = data.data.id;
                        ajaxGet(BASE_URL + 'cc/installation/quality/report/installationQualityReportSubmit', {
                            id: id,
                            enginnerId: app.getUser().enginnerId
                        }, function (data) {
                            if (data.code === 200) {
								// h('#saveBtn').removeAttr('disabled');
                                app.closeWaiting()
                                app.toast("提交成功")
                                var workReportList = plus.webview.getWebviewById('view/service/report/work/workReportList.html')
                                if (workReportList) {
                                    workReportList.evalJS("initData()")
                                }
								saveDelPartIds = "";
                                mui.back();
                            } else {
								h('#submitBtn').removeAttr('disabled');
                                app.closeWaiting()
                                app.toast(data.msg)
                            }
                        }, function (errorMsg) {
							h('#submitBtn').removeAttr('disabled');
                            app.closeWaiting()
                            app.toast(errorMsg)
                        });
                    } else {
						h('#submitBtn').removeAttr('disabled');
                        app.closeWaiting()
                        app.toast(data.msg)
                    }
                })
            })
        });
    }(mui, document));

    // 安装质量报告页面自动带入项数据查询
    function initData() {
        // 如果ID不为空 是修改
        app.showWaiting()
        if (id != undefined && id != "") {
            ajaxGet(BASE_URL + "cc/installation/quality/report/getInstallationQualityReport", {
                "id": id
            }, function (data) {
                app.closeWaiting()
                if (data.code == 200) {
                    h("#installStartTime").html(data.data.installStartTime)
                    h("#installEndTime").html(data.data.installEndTime)
                    h("#warrantyStartTime").html(data.data.warrantyStartTime)
                    h("#warrantyEndTime").html(data.data.warrantyEndTime)
                    h("#workTime").val(data.data.workTime)
                    // edit by wlf 2020-05-18 旅途小时数保留1位小数
                    var time = data.data.tripTime;
                    if (emptyStr(time) != "") {
                        var number = Number(time)
                        h("#tripTime").val(number)
                    } else {
                        h("#tripTime").val(0)
                    }
                    h("#wasteTime").val(data.data.wasteTime)
                    h("#workOvertime").val(data.data.workOvertime)
                    equipmentType1 = data.data.equipmentType1 ? data.data.equipmentType1 : '';
                    serialNumber1 = data.data.serialNumber1 ? data.data.serialNumber1 : '';
                    equipmentType2 = data.data.equipmentType2 ? data.data.equipmentType2 : '';
                    serialNumber2 = data.data.serialNumber2 ? data.data.serialNumber2 : '';
                    equipmentType3 = data.data.equipmentType3 ? data.data.equipmentType3 : '';
                    serialNumber3 = data.data.serialNumber3 ? data.data.serialNumber3 : '';
                    computerMfr = data.data.computerMfr ? data.data.computerMfr : '';
                    modelNumber = data.data.modelNumber ? data.data.modelNumber : '';
                    serviceNumber = data.data.serviceNumber ? data.data.serviceNumber : '';
                    software = data.data.software ? data.data.software : '';
                    optionSoftware = data.data.optionSoftware ? data.data.optionSoftware : '';
                    systemSoftware = data.data.systemSoftware ? data.data.systemSoftware : '';
                } else {
					app.toast(data.msg);
				}
            }, function (errorMsg) {
				app.toast(errorMsg);
                app.closeWaiting();
            });
        } else {
            // 否则是新增
            ajaxGet(BASE_URL + "cc/installation/quality/report/initData", {
                "serviceNo": h("#serviceNoV").val(),
                "enginnerId": app.getUser().enginnerId
            }, function (data) {
                app.closeWaiting()
                if (data.code == 200) {
                    h("#instrumentNo").val(data.data.serviceInstrumentList[0].instrumentId)
                    if (id == undefined || id == "") {
                        h("#installStartTime").html(data.data.fse.startTime)
                        h("#installEndTime").html(data.data.fse.endTime)
                        h("#warrantyStartTime").html(data.data.baoxiu.startTime)
                        h("#warrantyEndTime").html(data.data.baoxiu.endTime)
                        h("#workTime").val(data.data.workinfo.workTime)
                        h("#tripTime").val(data.data.workinfo.travelTime)
                        InstrumentCode = data.data.serviceInstrumentList[0].instrumentId;
                        var state = data.data.state;
                        // 服务报告
                        if (state == "stServiceReport") {
                            h("#workTime").val(data.data.stServiceReport.chargeHours)
                            // h("#tripTime").val(data.data.stServiceReport.travelTime)
                            // edit by wlf 2020-05-18 旅途小时数保留1位小数
                            var time = data.data.stServiceReport.travelTime;
                            if (emptyStr(time) != "") {
                                var number = Number(time);
                                h("#tripTime").val(number)
                            } else {
                                h("#tripTime").val(0)
                            }
                        }
                        // 电话解决报告
                        else if (state == "stPhoneReport") {
                            h("#workTime").val(data.data.stPhoneReport.equivalentToHuors)
                        }
						
						getSoftwareAndParts(InstrumentCode);
                    }
                } else {
					app.toast(data.msg);
				}
            }, function (errorMsg) {
				app.toast(errorMsg);
                app.closeWaiting();
            });
        }
    }
	
	// 获取软件信息带入数据
	function getSoftwareAndParts(InstrumentCode) {
		ajaxGet(BASE_URL + "cc/installation/quality/report/initSoftwareAndPartsData", {
			"serviceNo": h("#serviceNoV").val(),
			"instrumentCode": InstrumentCode
		}, function(data) {
			if(data.code==200){	
				if(data.data && data.data.length > 0){
					equipmentType1 = data.data[0].equipment_type1 ? data.data[0].equipment_type1 : "";
					serialNumber1 = data.data[0].serial_number1 ? data.data[0].serial_number1 : "";
					equipmentType2 = data.data[0].equipment_type2 ? data.data[0].equipment_type2 : "";
					serialNumber2 = data.data[0].serial_number2 ? data.data[0].serial_number2 : "";
					equipmentType3 = data.data[0].equipment_type3 ? data.data[0].equipment_type3 : "";
					serialNumber3 = data.data[0].serial_number3 ? data.data[0].serial_number3 : "";
					computerMfr = data.data[0].computerMfr ? data.data[0].computerMfr : "";
					modelNumber = data.data[0].modelNumber ? data.data[0].modelNumber : "";
					serviceNumber = data.data[0].serviceNumber ? data.data[0].serviceNumber : "";
					software = data.data[0].software ? data.data[0].software : "";
					optionSoftware = data.data[0].optionSoftware ? data.data[0].optionSoftware : "";
					systemSoftware = data.data[0].systemSoftware ? data.data[0].systemSoftware : "";	
				}
			} else {
				app.toast(data.msg);
			}
		}, function(errorMsg) {
			console.log(JSON.stringify(errorMsg))
		});
	}
	
	// 备件列表页传值方法
	function childDelPartIds(delPartIds){
		saveDelPartIds = delPartIds;
		console.log(saveDelPartIds)
	}

    // 子页面赋值方法
    function childData(
        equipmentType11,
        serialNumber11,
        equipmentType21,
        serialNumber21,
        equipmentType31,
        serialNumber31,
        computerMfr1,
        modelNumber1,
        serviceNumber1,
        software1,
        optionSoftware1,
        systemSoftware1
    ) {
        equipmentType1 = equipmentType11;
        serialNumber1 = serialNumber11;
        equipmentType2 = equipmentType21;
        serialNumber2 = serialNumber21;
        equipmentType3 = equipmentType31;
        serialNumber3 = serialNumber31;
        computerMfr = computerMfr1;
        modelNumber = modelNumber1;
        serviceNumber = serviceNumber1;
        software = software1;
        optionSoftware = optionSoftware1;
        systemSoftware = systemSoftware1;

        // 打印参数
        console.log(equipmentType1 + "	,	" +
            serialNumber1 + "	,	" +
            equipmentType2 + "	,	" +
            serialNumber2 + "	,	" +
            equipmentType3 + "	,	" +
            serialNumber3 + "	,	" +
            computerMfr + "	,	" +
            modelNumber + "	,	" +
            serviceNumber + "	,	" +
            software + "	,	" +
            optionSoftware + "	,	" +
            systemSoftware)
    }

</script>
<!-- js代码 end -->
</body>
</html>
